using System.Linq;

namespace eBookDirectory.Infrastructure.Repository
{
    /// <summary>
    /// We need to provide a single implementation for our domain 
    /// layer and services that can be used in a transparent manner
    /// without having to develop individual implementations for each 
    /// entity type. We also need a design that can provide a mechanism 
    /// for articulating specialised calls to the back-end, if required, 
    /// for different purposes like reporting, performance, and so on. 
    /// </summary>
    public interface IRepositoryLocator
    {
        TEntity Save<TEntity>(TEntity instance);
        void Update<TEntity>(TEntity instance);
        void Remove<TEntity>(TEntity instance);

        TEntity GetById<TEntity>(long id);
        IQueryable<TEntity> FindAll<TEntity>();

        IRepository<T> GetRepository<T>();
    }
}